package pokerTests;

import junit.framework.TestCase;
import poker.*;

public class TableAnalTest extends TestCase {

	public void testPlzGood() throws Exception {
		int cards[] = { 0, 13, 26, 2, 15 };
		int result[] = new int[6];
		Table.analyzeCards(result, cards);
		assertSame(result[0], 7);
		assertSame(result[1], 0);
		assertSame(result[2], 0);
		assertSame(result[3], 0);
		assertSame(result[4], 0);
		assertSame(result[5], 0);
	}

	public void testPoker() throws Exception {
		int cards[] = { 0, 1, 2, 3, 4 };
		int result[] = new int[6];
		Table.analyzeCards(result, cards);
		assertSame(result[0], 9);
		assertSame(result[1], 4);
		assertSame(result[2], 0);
		assertSame(result[3], 0);
		assertSame(result[4], 0);
		assertSame(result[5], 0);
	}

	public void testFour() throws Exception {
		int cards[] = { 1, 14, 27, 40, 4 };
		int result[] = new int[6];
		Table.analyzeCards(result, cards);
		assertSame(result[0], 8);
		assertSame(result[1], 1);
		assertSame(result[2], 0);
		assertSame(result[3], 0);
		assertSame(result[4], 0);
		assertSame(result[5], 0);
	}

	public void testFull() throws Exception {
		int cards[] = { 2, 15, 28, 3, 16 };
		int result[] = new int[6];
		Table.analyzeCards(result, cards);
		assertSame(result[0], 7);
		assertSame(result[1], 2);
		assertSame(result[2], 0);
		assertSame(result[3], 0);
		assertSame(result[4], 0);
		assertSame(result[5], 0);
	}

	public void testStraight() throws Exception {
		Human h = new Human("z", 100);
		h.receiveCard((short) 0);
		h.receiveCard((short) 14);
		h.receiveCard((short) 2);
		h.receiveCard((short) 29);
		h.receiveCard((short) 43);
		int cards[] = new int[5];
		h.reportCards(cards);
		int result[] = new int[6];
		Table.analyzeCards(result, cards);
		assertSame(result[0], 5);
		assertSame(result[1], 4);
		assertSame(result[2], 0);
		assertSame(result[3], 0);
		assertSame(result[4], 0);
		assertSame(result[5], 0);
	}
	/*
	 * public void testThree() throws Exception { h = new Human();
	 * h.receiveCard((short)5); h.receiveCard((short)18);
	 * h.receiveCard((short)31); h.receiveCard((short)3);
	 * h.receiveCard((short)4);
	 * 
	 * int result[] = new int[6]; h.reportCards(result); assertSame(result[0],
	 * 4); assertSame(result[1], 5); assertSame(result[2], 0);
	 * assertSame(result[3], 0); assertSame(result[4], 0); assertSame(result[5],
	 * 0); }
	 * 
	 * public void testDouble() throws Exception { h = new Human();
	 * h.receiveCard((short)0); h.receiveCard((short)13);
	 * h.receiveCard((short)18); h.receiveCard((short)31);
	 * h.receiveCard((short)4);
	 * 
	 * int result[] = new int[6]; h.reportCards(result); assertSame(result[0],
	 * 3); assertSame(result[1], 5); assertSame(result[2], 0);
	 * assertSame(result[3], 4); assertSame(result[4], 0); assertSame(result[5],
	 * 0); }
	 * 
	 * public void testPair() throws Exception { h = new Human();
	 * h.receiveCard((short)10); h.receiveCard((short)23);
	 * h.receiveCard((short)2); h.receiveCard((short)3);
	 * h.receiveCard((short)4);
	 * 
	 * int result[] = new int[6]; h.reportCards(result); assertSame(result[0],
	 * 2); assertSame(result[1], 10); assertSame(result[2], 4);
	 * assertSame(result[3], 3); assertSame(result[4], 2); assertSame(result[5],
	 * 0); }
	 * 
	 * public void testBambo() throws Exception { h = new Human();
	 * h.receiveCard((short)0); h.receiveCard((short)15);
	 * h.receiveCard((short)51); h.receiveCard((short)46);
	 * h.receiveCard((short)34);
	 * 
	 * int result[] = new int[6]; h.reportCards(result); assertSame(result[0],
	 * 1); assertSame(result[1], 12); assertSame(result[2], 8);
	 * assertSame(result[3], 7); assertSame(result[4], 2); assertSame(result[5],
	 * 0); }
	 * 
	 * public void testFive() throws Exception { h = new Human();
	 * h.receiveCard((short)14); h.receiveCard((short)14);
	 * h.receiveCard((short)14); h.receiveCard((short)14);
	 * h.receiveCard((short)14);
	 * 
	 * int result[] = new int[6]; h.reportCards(result); assertSame(result[0],
	 * 8); assertSame(result[1], 1); assertSame(result[2], 0);
	 * assertSame(result[3], 0); assertSame(result[4], 0); assertSame(result[5],
	 * 0); }
	 */
}
